package com.summerli.controller;

import com.alibaba.fastjson.JSONObject;
import com.summerli.common.ResponseResult;
import com.summerli.common.sms.SmsSendRequest;
import com.summerli.service.SmsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/send")
@Slf4j
public class SendController {

    @Autowired
    private SmsService smsService;

    @RequestMapping(value="/alisms-template",method = RequestMethod.POST)
    public ResponseResult sendSms(@RequestBody SmsSendRequest smsSendRequest){
        log.info("--invoke send_alisms-template request"+ JSONObject.toJSONString(smsSendRequest));
        return smsService.sendSms(smsSendRequest);
    }
}
